import { defineStore } from "pinia";
import { ref } from "vue";

export const useUserStore = defineStore("user", () => {
    //创建用户登录状态实例
    const isLogin = ref(localStorage.getItem('loginState') == 'true');

    function changeLogin(style) {
        localStorage.setItem('loginState', style);
        isLogin.value = style == 'true';
    }

    return {
        isLogin,
        changeLogin
    }
});